package hongcaosp.app.android.user.settings.invite;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import hongcaosp.app.android.R;
import hongcaosp.app.android.common.BaseHolder;
import hongcaosp.app.android.modle.bean.Income;
import hongcaosp.app.android.modle.bean.InviteRecord;
import xlj.lib.android.base.utils.DateUtil;
import xlj.lib.android.base.view.OnRecycleItemClickListener;

/**
 *
 */
public class InviteRecordHolder extends BaseHolder<InviteRecord> {

    private ImageView iv_photo;
    private TextView tv_name,tv_date,tv_money;

    public InviteRecordHolder(View itemView, OnRecycleItemClickListener recycleItemClickListener) {
        super(itemView, recycleItemClickListener);
        iv_photo = itemView.findViewById(R.id.iv_photo);
        tv_name = itemView.findViewById(R.id.tv_name);
        tv_date = itemView.findViewById(R.id.tv_date);
        tv_money = itemView.findViewById(R.id.tv_money);
    }

    @Override
    public void setData(InviteRecord income) {
        super.setData(income);
        Glide.with(iv_photo.getContext()).load(income.getImage()).into(iv_photo);
        tv_name.setText("" + income.getNickname());
        tv_money.setText(income.getInvitationAmount() == 0 ? "" :  ""  + income.getInvitationAmount());
        tv_date.setText(DateUtil.stampToDate(income.getCreateTime(),"yyyy.MM.dd  HH:mm"));
    }
}
